package com.gitee.sidihuo.utils.async;

import com.gitee.sidihuo.utils.base.BaseThreadPool;
import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.BlockingQueue;
import java.util.concurrent.RejectedExecutionHandler;
import java.util.concurrent.TimeUnit;

@Slf4j
public class AsyncWorkerThreadPool extends BaseThreadPool {

    public AsyncWorkerThreadPool(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, RejectedExecutionHandler handler) {
        super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, handler);
    }

    public AsyncWorkerThreadPool(int corePoolSize, int maximumPoolSize) {
        super(corePoolSize, maximumPoolSize);
    }


    private static AsyncWorkerThreadPool THREAD_POOL = new AsyncWorkerThreadPool(10, 20);

    public static AsyncWorkerThreadPool getThreadPool() {
        return THREAD_POOL;
    }

    public static void setThreadPool(AsyncWorkerThreadPool threadPool) {
        THREAD_POOL = threadPool;
    }

}
